$(function () {
	var columns = [

			{ checkbox: true, align: 'center' },
			{ title: '科室名称', field: 'deptName' }, 			
			{ title: '医院', field: 'hospital.hospitalName' }, 			
			{ title: '创建时间', field: 'createTime' }			
]

$("#table").bootstrapTable({
	        url: baseURL + 'dept/list',
	        cache: false,
	        striped: true,
	        pagination: true,
	        pageSize: 10,
	        pageNumber: 1,
	        sidePagination: 'server',
	        pageList: [10, 25, 50],
	        columns: columns,
	        queryParams: function (params) {
	        	return {
		        	page: params.offset / 10 + 1,
		        	limit: params.limit
	        	}
	        }
	   });
});
var vm = new Vue({
	el:'#app',
	data:{
		showList: true,
		title: null,
		dept: {},
		hospitalList: []
	},
	methods: {
		query: function () {
			vm.reload();
		},
		add: function(){

		},
		update: function (event) {

		},
		saveOrUpdate: function (event) {

		},
		del: function (event) {

		},
		getInfo: function(id){
			$.get(baseURL + "dept/info/"+id, function(r){
                vm.dept = r.dept;
            });
		},
		getHospital: function(id){
			$.get(baseURL + "hospital/listAll", function(r){
                vm.hospitalList = r.hospitalList;
            });
		},
		reload: function (event) {
			vm.showList = true;
			$('#table').bootstrapTable('refreshOptions',  {pageNumber: 1});
		}
	},
	created: function(){
		this.getHospital();
	}
});